from sqlalchemy import Column, String, Float, Date, Integer
from infrastructure.model.base_model import BaseModel
# infrastructure/model/industry_kline.py
class IndustryKline(BaseModel):
    __tablename__ = 'industry_kline'
    
    id = Column(Integer, primary_key=True, autoincrement=True)
    industry_code = Column(String(20), nullable=False)  # 行业代码
    industry_name = Column(String(50), nullable=False)  # 行业名称
    trade_date = Column(Date, nullable=False)          # 交易日期
    open = Column(Float)                               # 开盘价
    high = Column(Float)                               # 最高价
    low = Column(Float)                                # 最低价
    close = Column(Float)                              # 收盘价
    volume = Column(Float)                             # 成交量
    amount = Column(Float)                             # 成交额
    
    __table_args__ = (
        sa.Index('idx_industry_kline_code_date', 'industry_code', 'trade_date', unique=True),
    )